home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / ka9q / kit_src / setatt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-03  |  1.7 KB  |  86 lines

  1. /*    (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
  2.  * 
  3.  *    Redistribution and use in source and binary forms are permitted for
  4.  *    non-commercial use, provided that the above copyright notice and this
  5.  *    paragraph are duplicated in all such forms.  THIS SOFTWARE IS PROVIDED
  6.  *    ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  7.  *    WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
  8.  *    FITNESS FOR A PARTICULAR PURPOSE.
  9.  */
  10. /*bdoc
  11.  *    Function SETATT
  12.  *
  13.  *    Written:  Dave Fritsche
  14.  *    Date:  July, 1987
  15.  *
  16.  *    Function to set attributes on screen.
  17.  *    0 -- All attributes off
  18.  *    1 -- Bold on
  19.  *    2 -- Faint on
  20.  *    3 -- Italic on
  21.  *    5 -- Blink on
  22.  *    6 -- Rapid blink on
  23.  *    7 -- Reverse video on
  24.  *    8 -- Concealed on
  25.  *    Syntax:
  26.  *        setatt(attribute)
  27.  *    Where:
  28.  *        attribute = Integer containing the attribute to add
  29.  *    Attributes are cumulative.  There must be a global variable defined
  30.  *    in function "main" called "attrib".  This is a char-type variable
  31.  *    that will contain the current attributes.
  32.  edoc*/
  33.  
  34. #include <stdio.h>
  35.  
  36. extern char attrib;
  37.  
  38. setatt(attr)
  39. int attr;
  40. {
  41.     int ps, first, n;
  42.  
  43.     switch (attr)
  44.     {
  45.     case 0:
  46.         attrib = 0;
  47.         lowvideo();
  48.         textattr(0x07);
  49.         break;
  50.     case 1:
  51.         attrib = attrib | 1;
  52.         highvideo();
  53.         break;
  54.     case 2:
  55.         attrib = attrib | 2;
  56.         lowvideo();
  57.         break;
  58.     case 3:
  59.         attrib = attrib | 4;
  60.         break;
  61.     case 5:
  62.     case 6:
  63.         attrib = attrib | 8;
  64.         if (attrib & 32)
  65.             textattr(0xf0);
  66.         else
  67.             if (attrib & 1)
  68.                 textattr(0x8f);
  69.             else
  70.                 textattr(0x87);
  71.         break;
  72.     case 7:
  73.         attrib = attrib | 32;
  74.         if (attrib & 8)
  75.             textattr(0xf0);
  76.         else
  77.             textattr(0x70);
  78.         break;
  79.     case 8:
  80.         attrib = attrib | 64;
  81.         break;
  82.     default:
  83.         break;
  84.     }
  85. }
  86.